<!-- 确认审核 -->
<template>
	<ListLayout>
		<!-- 审核信息 -->
		<HandleReviewCard ref="HandleReviewCard"></HandleReviewCard>
		<template #footer>
			<HButtonGroup @leftClick="leftClick" @rightClick="rightClick">
				<template #left>
					取消
				</template>
				<template #right>
					确认
				</template>
			</HButtonGroup>
		</template>
	</ListLayout>
</template>

<script>
	import ListLayout from '@/components/layout/listLayout.vue'
	import HandleReviewCard from '@/components/card/sendRepair/department/info/handleReview.vue'
	import AttachmentCard from '@/components/card/attachment.vue'
	import HButtonGroup from '@/components/buttonGroup/groupTwo.vue'
	import ReapirApi from '@/apis/repair.js'
	import SendRepairRouterConfig from '@/sendRepair/routerConfig.js'
	export default {
		components: {
			ListLayout,
			HandleReviewCard,
			AttachmentCard,
			HButtonGroup,
		},
		data() {
			return {
				routerParams: {
					id: ''
				}
			}
		},
		onLoad(query) {
			const {
				id
			} = query
			this.$set(this.routerParams, 'id', id)
		},
		methods: {

			leftClick() {
				wx.navigateBack()
			},
			// 确认
			async rightClick() {
				let {
					HandleReviewCard,
					AttachmentCard
				} = this.$refs
				let {
					reviewResult,
					remark,
					user,
					reason
				} = HandleReviewCard

				let params = {
					repairId: this.routerParams.id,
					repairFlag: reviewResult,
					failReason: reason,
					forwardUser: user,
					remark: remark,
				}
				await ReapirApi.department.confirmQuoteReview(params)
				wx.showToast({
					title: '审核成功!',
					icon: 'success',
					complete() {
						wx.redirectTo({
							url: SendRepairRouterConfig.Department.Index
						})
					}
				})
			},
		}

	}
</script>

<style>
</style>
